package com.song.su.provider;

import com.song.su.dto.BookMessage;
import com.song.su.model.User;
import org.springframework.stereotype.Component;

import java.util.ArrayList;

/**
 * 调用api接口查询图书 * */

@Component
public class BookProvider {
    public static ArrayList<BookMessage> bookMessageArrayList = new ArrayList<>();
    public static ArrayList<String> book_isbn = new ArrayList<>();
    public static ArrayList<String> book_names = new ArrayList<>();
    public static ArrayList<String> book_writer = new ArrayList<>();
    public static ArrayList<String> book_url_douban = new ArrayList<>();
    public static ArrayList<String> book_cover_url = new ArrayList<>();

    public static void do_provide(){
        book_isbn.add("123");
        book_isbn.add("124");
        book_isbn.add("125");
        book_isbn.add("9787505749788");
        book_isbn.add("9787520168618");
        book_names.add("湖面如镜");
        book_names.add("熟年");
        book_names.add("珠崖");
        book_names.add("生命唯愿爱与自由");
        book_names.add("一把海贝");
        book_writer.add("[马来西亚] 贺淑芳");
        book_writer.add("伊北");
        book_writer.add("[美] 薛爱华");
        book_writer.add("李银河");
        book_writer.add("[英]托比·格林");
        book_url_douban.add("https://book.douban.com/subject/35217438/");
        book_url_douban.add("https://book.douban.com/subject/35247614/");
        book_url_douban.add("https://book.douban.com/subject/35270899/");
        book_url_douban.add("https://book.douban.com/subject/35232573/");
        book_url_douban.add("https://book.douban.com/subject/35149225/");
        book_cover_url.add("https://img3.doubanio.com/view/subject/s/public/s33768590.jpg");
        book_cover_url.add("https://img1.doubanio.com/view/subject/s/public/s33766017.jpg");
        book_cover_url.add("https://img9.doubanio.com/view/subject/s/public/s33766605.jpg");
        book_cover_url.add("https://img3.doubanio.com/view/subject/s/public/s33745801.jpg");
        book_cover_url.add("https://img1.doubanio.com/view/subject/s/public/s33749759.jpg");
        for (int i = 0; i < book_isbn.size(); i++) {
            BookMessage bookMessage = new BookMessage();
            bookMessage.setIsbn(book_isbn.get(i));
            bookMessage.setBook_Writer(book_writer.get(i));
            bookMessage.setBookCoverUrl(book_cover_url.get(i));
            bookMessage.setBookUrl_douban(book_url_douban.get(i));
            bookMessage.setBookName(book_names.get(i));
            bookMessageArrayList.add(bookMessage);
            bookMessage = null;
        }

    }

}
